#!/bin/bash
#    Copyright (C) 2017  Jonathan Jason Dennis [Meticulus]
#					theonejohnnyd@gmail.com
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

source common.cfg

TOP=$(getTop)

cd $TOP

checkerror $? "Where is TOP?!" -fatal

cd vendor

checkerror $? "$PWD/vendor does not exist!" -fatal

if [[ -e lineage ]]; then

    if [[ "$(cat cm/README.mkdn)" == *"Resurrection Remix"* ]]; then

	echo "rr"
    else

    	echo "lineage" 
    fi

elif [[ -e cm ]]; then

    if [[ "$(cat cm/README.mkdn)" == *"Resurrection Remix"* ]]; then

	echo "rr"
    else

    	echo "cm" 

    fi

elif [[ -e rr ]]; then

    echo "rr"

elif [[ -e beanstalk ]]; then

    echo "bs"

elif [[ -e bliss ]]; then

    echo "bliss"

elif [[ -e pa ]]; then

    echo "pa"

elif [[ -e carbon ]]; then

    echo "carbon"

elif [[ -e slim ]]; then

    echo "slim"

elif [[ -e omni ]]; then

    echo "omni"

elif [[ -e validus ]]; then

    echo "validus"

elif [[ -e gzosp ]]; then

    echo "gz"


else

    echo "aosp"

fi
